﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true" CodeBehind="ProductView.aspx.cs" Inherits="Thuoc24h.AdminCP.Pages.ProductView" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" runat="server">
    <Telerik:RadGrid runat="server" AutoGenerateColumns="False" ID="gridData" CellSpacing="0" GridLines="None" DataSourceID="NewsEds" Width="100%"
        AllowPaging="True" AllowCustomPaging="True" OnItemCommand="gridData_ItemCommand" AllowSorting="True">
        <MasterTableView ClientDataKeyNames="Id" DataKeyNames="Id" GroupLoadMode="Client" CommandItemDisplay="Top"
            PageSize="20" NoMasterRecordsText="Không có bản ghi nào.">
            <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Thêm mới" RefreshText="Tải lại" ShowAddNewRecordButton="True" ShowRefreshButton="True"></CommandItemSettings>
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>

            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <GroupByExpressions>
            </GroupByExpressions>
            <Columns>
                <Telerik:GridTemplateColumn HeaderText="STT" UniqueName="Id">
                    <ItemStyle HorizontalAlign="Left" CssClass="center" />
                    <ItemTemplate>
                        <%#
                   (gridData.PageSize * (gridData.CurrentPageIndex + 1)) - gridData.PageSize + Container.ItemIndex + 1
                        %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="50px" />
                </Telerik:GridTemplateColumn>
                <Telerik:GridTemplateColumn HeaderText="Tiêu đề" UniqueName="Title">

                    <ItemTemplate>
                        <%# Eval("Name") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" />
                </Telerik:GridTemplateColumn>
                <Telerik:GridTemplateColumn HeaderText="Giá" UniqueName="Price">

                    <ItemTemplate>
                        <%# Eval("Price") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" />
                </Telerik:GridTemplateColumn>
                <Telerik:GridTemplateColumn HeaderText="Giảm giá (%)" UniqueName="DiscountPercent">

                    <ItemTemplate>
                        <%# Eval("DiscountPercent") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="80" />
                </Telerik:GridTemplateColumn>

                <Telerik:GridTemplateColumn HeaderText="Lượt xem" UniqueName="ViewCount">

                    <ItemTemplate>
                        <%# Eval("ViewCount") ?? "0" %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" Width="60" />
                </Telerik:GridTemplateColumn>
                <Telerik:GridTemplateColumn HeaderText="Ngày tạo" UniqueName="Order">

                    <ItemTemplate>
                        <%# Eval("CreatedDate") %>
                    </ItemTemplate>
                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="150" />
                </Telerik:GridTemplateColumn>


                <Telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" ConfirmDialogType="RadWindow"
                    HeaderText="Sửa"
                    Text="Sửa" UniqueName="Edit">
                    <ItemStyle CssClass="center" Width="32px" />
                    <HeaderStyle HorizontalAlign="Center" Width="32px" Font-Bold="True" />
                </Telerik:GridButtonColumn>
                <Telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmDialogType="RadWindow"
                    ConfirmText="Bạn có chắc chắn muốn xóa" ConfirmTitle="Xóa" HeaderText="X&#243;a"
                    Text="X&#243;a" UniqueName="Delete">
                    <ItemStyle CssClass="center" Width="32px" />
                    <HeaderStyle HorizontalAlign="Center" Width="32px" Font-Bold="True" />
                </Telerik:GridButtonColumn>
            </Columns>

            <EditFormSettings EditFormType="Template">
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>

            </EditFormSettings>

        </MasterTableView>
        <ClientSettings EnableRowHoverStyle="True">
        </ClientSettings>
        <FilterMenu EnableImageSprites="False"></FilterMenu>

        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>


    </Telerik:RadGrid>

    <asp:EntityDataSource runat="server" ID="NewsEds" ConnectionString="name=MedLifeDataContext" DefaultContainerName="MedLifeDataContext" EnableFlattening="False" EntitySetName="Products" Select="it.[Id], it.[Name], it.[Price], it.[DiscountPercent], it.[IsGroupBuy], it.[CreatedDate], it.[ViewCount], it.[BuyCount], it.[IsSalesOff]" AutoGenerateWhereClause="True" OrderBy="it.[Id] DESC"  Where="">
        <OrderByParameters>
            <asp:Parameter Name="Id" DefaultValue="" Type="Int32" />
        </OrderByParameters>
    </asp:EntityDataSource>


</asp:Content>
